package com.damei.qmui_test_demo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.damei.qmui_test_demo.R;
import com.damei.qmui_test_demo.activity.login.PhoneLoginActivity;
import com.damei.qmui_test_demo.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 登录
 */
public class LoginActivity extends BaseActivity {

    //协议勾选图片
    @BindView(R.id.select_image) ImageView selectImg;
   //是否勾选协议
    protected boolean isSelect = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        ButterKnife.bind(this);

        selectImg.setImageResource(R.drawable.select_def);
    }

    @OnClick({R.id.login_wechat_btn, R.id.login_phone_btn, R.id.select_layout})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.login_wechat_btn:
                Toast.makeText(this, "点击微信登录", Toast.LENGTH_SHORT).show();
                break;
            case R.id.login_phone_btn:
                startActivity(new Intent(this, PhoneLoginActivity.class));
                break;
            case R.id.select_layout:
                if (isSelect) {
                    selectImg.setImageResource(R.drawable.select_pre);
                    isSelect = false;
                }
                else {
                    selectImg.setImageResource(R.drawable.select_def);
                    isSelect = true;
                }
                break;
        }
    }
}
